#include <cstdio>
#include <algorithm>
#include <vector>


int const maxn = 1<<20;
std::vector<int> tmp_rank(maxn);

struct suffix_array
{
	typedef std::vector<int> & v_ref;
	typedef std::vector<int> const & v_cref;

	struct suffix_cmp
	{
		suffix_cmp(v_cref rank, int const & gap, int const & n)
			: rank(rank), gap(gap), n(n) {}

		bool operator()(int i, int j)
		{
			if (rank[i] != rank[j]) return rank[i] < rank[j];
			return (i + gap < n && j + gap < n) ?
				(rank[i + gap] < rank[j + gap]) : (i > j);
		}

	private:
		v_cref rank;
		int const & gap;
		int const & n;
	};

	suffix_array(v_cref s, v_ref sa, v_ref rank, v_ref height)
		: s(s), sa(sa), rank(rank), height(height) {}

	void init_suffix_array(int n)
	{
		tmp_rank[0] = 0;
		for (int i = 0; i < n; i++) { sa[i] = i; rank[i] = s[i]; }
		for (int gap = 1; ; gap *= 2) {
			suffix_cmp cmp(rank, gap, n);
			std::sort(sa.begin(), sa.begin() + n, cmp);
			for (int i = 0; i < n - 1; i++)
				tmp_rank[i + 1] = tmp_rank[i] + cmp(sa[i], sa[i + 1]);
			for (int i = 0; i < n; i++) rank[sa[i]] = tmp_rank[i];
			if (tmp_rank[n - 1] == n - 1) break;
		}
	}

	void init_lcp(int n)
	{
		for (int i = 0, k = 0; i < n; i++)
			if (rank[i] != n - 1) {
				for (int j = sa[rank[i] + 1]; s[i + k] == s[j + k]; k++);
				height[rank[i]] = k;
				if (k) k--;
			}
	}

private:
	v_cref s;
	v_ref sa;
	v_ref rank;
	v_ref height;
};

std::vector<int> s(maxn);
std::vector<int> sa(maxn);
std::vector<int> rank(maxn);
std::vector<int> height(maxn);
std::vector<int> min_rank0(maxn);

int main()
{
	suffix_array suffix(s, sa, rank, height);
	while (true) {
		char ch = std::getchar();
		if (ch == '.') break;
		int n = 0; s[n++] = ch;
		while ('\n' != (ch = std::getchar()))
			s[n++] = ch;

		suffix.init_suffix_array(n);
		suffix.init_lcp(n);

		min_rank0[rank[0]] = 1<<25;
		for (int i = rank[0] + 1; i < n; i++)
			min_rank0[i] = std::min(min_rank0[i - 1], height[i-1]);
		for (int i = rank[0] - 1; i >= 0; i--)
			min_rank0[i] = std::min(min_rank0[i + 1], height[i]);

		/*
		std::cerr << "rank: \n";
		for (int i = 0; i < n; i++)
			std::cerr << rank[i] << ' ';
		std::cerr << '\n';

		std::cerr << "height: \n";
		for (int i = 0; i < n; i++)
			std::cerr << height[i] << ' ';
		std::cerr << '\n';

		std::cerr << "min to sa[0]: \n";
		for (int i = 0; i < n; i++)
			std::cerr << min_rank0[i] << ' ';
		std::cerr << '\n';
		*/


		int ans = 1;
		for (int len = 1; len <= n; len++)
			if (!(n % len) && min_rank0[rank[len]] == n - len) {
				ans = n / len;
				break;
			}

		std::printf("%d\n", ans);
	}
}
